package com.lmt.ymcc.feign;

import com.lmt.ymcc.dto.CourseDoc;
import com.lmt.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * @Author: Amazing
 * @Date: 2022/8/14 15:10
 * @Version: 1.0
 */
@Component
public class SearchFeignFallbackFactory implements FallbackFactory<SearchFeignClient> {


    @Override
    public SearchFeignClient create(Throwable throwable) {
        return new SearchFeignClient() {
            @Override
            public JSONResult saveCourse(CourseDoc doc) {
                throwable.printStackTrace();
                return JSONResult.error("系统错误，返回兜底数据");
            }

            @Override
            public JSONResult delete(Long id) {
                throwable.printStackTrace();
                return JSONResult.error("系统错误，返回兜底数据");
            }
        };
    }
}
